import { defineStore } from 'pinia'
export const useUserStore = defineStore({
  id: 'web-user',
  state: () => {
    return {
      token: '',
      // 用户信息
      userInfo: null,
    }
  },
  getters: {
    getToken() {
      return this.token
    },
    getUserInfo() {
      return this.userInfo
    }
  },
  actions: {
    setToken(val) {
      this.token = val
    },

    setUserInfo(val) {
      this.userInfo = val
    },

    logout() {
      this.token = ''
      this.userInfo = ''
    },
  },
  persist: true
})


